import React, { Component } from 'react'
import { Carousel } from 'antd';
import { Spin, Space } from 'antd';
import './Banner.less';

// data
import data from '@assets/data/banner.js'

class Banner extends Component {
    constructor(props) {
        super(props);
    }
    render() {
        let pics;
        if (data.length) {
            pics = data.map(function (value, key) {
                return (<div key={key}>
                    <img src={value.src} alt={value.txt} />
                </div>)
            });
        } else {
            pics = (<Space size="middle">
                <Spin />
            </Space>)
        }

        return (
            <Carousel effect="fade" dots={"dots"}>
                {pics}
            </Carousel>
        )
    }

}
export default Banner;